package com.vichat.user.service;

import com.vichat.common.enums.RecordType;
import com.vichat.common.exception.ViChatException;
import com.vichat.common.vo.PageFilter;
import com.vichat.user.entity.*;
import com.vichat.user.vo.AgentUseVO;
import com.vichat.user.vo.AgentUserOnlineVO;
import com.vichat.user.vo.UserBasicVO;

import java.util.List;
import java.util.Map;

/**
 * Created by wangluyin on 16/9/17.
 */
public interface IUserAgentService {
    /**
     * 增加子账号
     *
     * @param user
     * @return
     */
    public UserBasic saveUserBasicAgent(UserBasic user, AgentUser sessionUser) throws ViChatException;

    List<UserPartyCompany> queryUserCompanyCCS(UserPartyCompany company, UserBasic user, PageFilter pf, boolean isPrecision) throws Exception;

    public Long countUserCompanyCCS(UserPartyCompany company, UserBasic user, boolean isPrecision) throws Exception;

    public void saveUserPartyCompany(UserPartyCompany company);

    /**
     * 客服修改密码
     *
     * @param uid
     * @param newPassWord
     */
    public UserBasic ccsChgUserPass(long uid, String newPassWord);

    /**
     * 批量导入客户
     *
     * @param users
     * @return
     */
    public Map<String, List<UserBasic>> batchCreateUser(List<UserBasic> users, AgentUser sessionUser);

    /**
     * 批量更新客户信息
     *
     * @param users
     * @return
     */
    public Map<String, List<UserBasic>> batchUpdateUser(List<UserBasic> users, AgentUser sessionUser);


    /**
     * 保存操作日志
     *
     * @param user
     * @param type
     * @param opedUid
     * @param opedUserName
     * @param opedInfo
     * @param remark
     * @throws Exception
     */
    public void saveSysAgentBusiRecord(AgentUser user, RecordType type, long opedUid, String opedUserName, String opedInfo, String remark);

    /**
     * 注册(公司类型)接口，包括初始管理员账号，账号必须为手机
     *
     * @param party
     * @param company
     * @param user
     */
    public void registerPartyCompany(UserParty party, UserPartyCompany company, UserBasic user) throws ViChatException;

    public UserBasic getPartyUserByPartyId(long partyId, long userType);

    public AgentUser getAgentUserByUid(long uid);

    public AgentUser getAgentUserByAccount(String account);
    public AgentUser getAgentUserByAccountToLogin(String account);

    public void updateExpiredDate(AgentUser sessionUser, UserBasic userFDB, Integer monthNumber) throws ViChatException;

    public void updateAgentExpiredDate(AgentUser sessionUser, AgentCompany agentCompanyOut, Integer monthNumber, String remark) throws ViChatException;

    public void updateCompanyExpiredDate(AgentUser sessionUser, UserPartyCompany companyOut, Integer monthNumber, String remark) throws ViChatException;

    public AgentCompany getAgentCompanyByAgentId(long agentId);

    public List<AgentUser> queryAgentUsers(AgentUser user, PageFilter pf) throws Exception;

    public Boolean isTerminalExist(String terminal);

    public void registerAgentCompany(AgentUser user, AgentCompany company) throws ViChatException;

    public List<AgentCompany> queryAgentCompany(AgentUser user, AgentCompany company, PageFilter pf) throws Exception;

    public long countAgentCompany(AgentUser user, AgentCompany company) throws Exception;

    public AgentUser getAgentUserByAgentId(long agentId, long userType);

    public void saveAgentCompany(AgentCompany company);

    public AgentUser ccsChgAgentUserPass(long uid, String newPassWord);

    public Long countAgentUsers(AgentUser user) throws Exception;

    public AgentUser saveAgentUser(AgentUser agentUser) throws ViChatException;

    public Map<String, List<AgentUser>> batchCreateAgentUser(List<AgentUser> users);

    public Map<String, List<AgentUser>> batchUpdateAgentUser(List<AgentUser> user);

    public void batchUpdateAgentUser(Long agentUid, Long state) throws ViChatException;
    public void deleteAgentUser(Long agentUid) throws ViChatException;

    /**
     * 获取人员总览
     *
     * @return
     */
    public AgentUserOnlineVO getUserOnlineView(AgentUser queryBean) throws Exception;

    public List<RechargeRecord> queryRechargeRecord(RechargeRecord creditRecord, boolean isPrecise, PageFilter pageFilter) throws Exception;

    public long countRechargeRecord(RechargeRecord creditRecord, boolean isPrecise) throws Exception;

    public void setRechargeRecordRemark(long logId, String remark) throws ViChatException;

    public List<AgentUseVO> queryAgentCompanyShort(String name, Long agentId, Long partentId, PageFilter pageFilter) throws ViChatException;

    public List<UserPartyCompany> queryUserPartyCompanyShort(String name, long agentId, PageFilter pageFilter) throws ViChatException;

    public List<UserBasic> queryUserBasicShort(String name, long partyId, PageFilter pageFilter) throws ViChatException;

    public SnResource querySnResourceBySN(String sn);

    public SnResource queryNotAssignSnResourceBySN(String sn, long agentId);

    public SnResource saveSnResource(SnResource snResource);

    public List<SnResource> querySnResource(SnResource snResource, PageFilter pageFilter);

    public long countSnResource(SnResource snResource);

    public void deleteAgent(long agentId) ;

    /**
     * 获取客服用户信息
     *
     * @param uid
     * @return
     */
    public CcsUser getCcsUserInfoById(long uid);

    public List<UserBasic> queryUserBasicToRecharge(UserBasic queryBean, PageFilter pf, long agentId) throws Exception;
    public long countUserBasicToRecharge(UserBasic queryBean,long agentId) throws Exception;
}
